<template>
  <view class="goodsList">
    <view class="item" @click="toke(el.id)"
          v-for="el in dataList"
          :key="el.id">
      <view class="left">
        <image :src="$serverIp+el.image"></image>
        <view class="title">
          <slot name="title"></slot>
        </view>

      </view>
      <view class="right">
        <view class="top"> {{el.name}} </view>
        <view class="middle"
              v-if="el.buy_num!=undefined"> {{el.buy_num}} 人已学习 </view>
        <view class="time">
          <slot name="time"
                :item="el"></slot>
        </view>
        <view class="bottom">
          <view class="info"
                v-if="el.all_num"> {{el.all_num}} 套资料|真题 </view>
          <view class="price"
                v-if="el. now_price||el.price"> ￥{{el. now_price||el.price }}
          </view>
        </view>
      </view>
    </view>
  </view>
</template>

<script>
export default {
  props: {
    dataList: Array
  }
}
</script>

<style lang="scss">
.goodsList {
  width: 750rpx;
  overflow: hidden;
  background-color: #fff;
  margin-top: 20rpx;
  padding: 0 30rpx;
  box-sizing: border-box;

  .item {
    display: flex;
    align-items: center;
    .left {
      position: relative;
      image {
        width: 98 * 2rpx;
        height: 65 * 2rpx;
        margin-right: 20rpx;
        border-radius: 10rpx;
      }

      .title {
        position: absolute;
        left: 0;
        top: 0;
        background-color: #ff3b30;
        color: #fff;
        font-size: 24rpx;
        padding: 0 10rpx;
        border-radius: 10rpx;
      }
    }
    .right {
      flex-grow: 1;
      height: 69 * 2rpx;
      padding-top: 20rpx;
      padding-bottom: 30rpx;
      display: flex;
      flex-direction: column;
      justify-content: space-between;
      border-bottom: 1rpx solid #eee;

      .top {
        font-weight: 700;
        font-size: 28rpx;
      }
      .middle {
        font-size: 24rpx;
        color: #666;
        display: flex;
        align-items: center;
        margin: 10rpx 0;
        &::before {
          content: '';
          width: 28rpx;
          height: 28rpx;
          background: url('/static/img/stud.png') no-repeat 0 0 / 100% 100%;
          margin-right: 10rpx;
        }
      }

      .time {
        font-size: 24rpx;
        color: #999;
      }
      .bottom {
        display: flex;
        justify-content: space-between;
        .info {
          font-size: 24rpx;
          color: #aaa;
        }
        .price {
          color: #ff3b30;
          font-weight: 900;
        }
      }
    }
  }
}
</style>